package pages;


import core.TestBase;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebElement;
import utils.Log4Test;

public class MainPage extends TestBase {

    private String URL = "http://rozetka.com.ua/";

    protected By searchField = By.xpath(".//*[@id='body-header']/div[2]/div/div/div/div[2]/form/div[2]/div[1]/input");
    protected By buttonSearch = (By.xpath(".//*[@id='body-header']/div[2]/div/div/div/div[2]/form/div[1]/span/button"));


    public void open()
    {

        webDriver.get(URL);
        Log4Test.info("Open WebUrl " + URL);

    }

    public boolean isOpened()
    {
        return webDriver.getCurrentUrl().equals(URL);
    }



   public void searchProduct(String productName)
    {
        Log4Test.info("Search product " + productName);
        webDriver.findElement(searchField).clear();
        webDriver.findElement(searchField).sendKeys(productName);
        webDriver.findElement(buttonSearch).click();

    }

}
